package hu.uniobuda.nik.openday;

import com.google.android.maps.MapActivity;

import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.ProgressBar;

public class BaseActivity extends MapActivity {

	private Button updateButton;
	private ProgressBar mProgressBar;

	@Override
	protected void onCreate(Bundle savedInstanceState) {		
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);		
	}

	public void setOnButtonclick(int res, View.OnClickListener listener) {
		updateButton.setText(getString(res));
		updateButton.setOnClickListener(listener);
	}

	public void setButtonVisible() {
		if(updateButton == null)
			updateButton = (Button) findViewById(R.id.btnUpdate);
		updateButton.setVisibility(View.VISIBLE);
	}

	public void setBusy(boolean busy) {
		if(mProgressBar == null)
			mProgressBar = (ProgressBar) findViewById(R.id.updateProgress);
		if (busy) {			
			updateButton.setVisibility(View.GONE);
			mProgressBar.setVisibility(View.VISIBLE);
		}else{
			updateButton.setVisibility(View.VISIBLE);
			mProgressBar.setVisibility(View.GONE);
		}
	}

	@Override
	protected boolean isRouteDisplayed() {
		return false;
	}
}